import http from '@/utils/http.js';

export default {
	// 数据列表
	sysRoleListApi: data => {
		return http.post('/sysRole/list', data);
	},
	// 添加数据
	sysRoleInsertApi: data => {
		return http.post('/sysRole/insert', data);
	},
	// 更新数据
	sysRoleUpdateApi: data => {
		return http.post('/sysRole/update', data);
	},
	// 通过id获取详情
	sysRoleDetailApi: params => {
		return http.get('/sysRole/detail', { params });
	},
	// 通过id批量删除数据
	sysRoleDeleteByIdApi: data => {
		return http.post('/sysRole/deleteById', data, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } });
	},
	// 查询角色已关联菜单
	getRoleRelationMenuApi: roleId => {
		return http.get(`/sysRole/roleRelationMenu/${roleId}`);
	},
	// 角色关联菜单
	setRoleRelationMenuApi: data => {
		return http.post('/sysRole/roleRelationMenu', data);
	},
	// 查询角色已关联用户
	getRoleRelationUserApi: roleId => {
		return http.get(`/sysRole/roleRelationUser/${roleId}`);
	},
	// 角色关联用户
	setRoleRelationUserApi: data => {
		return http.post('/sysRole/roleRelationUser', data);
	}
};
